<!DOCTYPE html>
<html>
<head>
	<title>2小时倒计时</title>
</head>
<body>
	<script type="text/javascript">
		  var total = 7200;
		 
        function strat() {
            var div = document.getElementById('timeCounter');
            // console.log(div);
            
            total--;
            var s = (total%60) < 10 ? ('0' + total%60) : total%60;
		    var h = total/3600 < 10 ? ('0' + parseInt(total/3600)) : parseInt(total/3600);
		    var m = (total-h*3600)/60 < 10 ? ('0' + parseInt((total-h*3600)/60)) : parseInt((total-h*3600)/60);

            div.innerHTML = h + ' : ' + m + ' : ' + s;

            if (total <= 0) {
                // clearTimeout(timer);
                return;
            }
            timer = setTimeout('strat()', 1000);
        }
	</script>

	

	<button onclick="strat()">开始</button>
	<div id="timeCounter" style="margin-left: 200px;margin-top: 200px;color: red;font-size: 50px;"><p>02:00:00</p></div>

</body>
</html>